package com.example.xunua_zhinengjiaotong;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.example.xunua_zhinengjiaotong.Dialog.BusDialog1;
import com.example.xunua_zhinengjiaotong.Dialog.BusDialog2;
import com.example.xunua_zhinengjiaotong.utils.MyApp;

public class busActivity extends AppCompatActivity implements View.OnClickListener {
    private ImageView img_back;
    private MyApp myApp;
    private RelativeLayout line1,line2,line3,line4,line5;
    //为公交界面的五个相对布局(五行)  依次为
    // 1、查询公交站台信息  2、查询公交位置   3、查询路况
    // 4、查询公交车的速度  5、查询车载容量


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bus);
        initView();
    }

    private void initView() {
        myApp= (MyApp) getApplication();
        img_back=findViewById(R.id.bus_img_back);
        img_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        line1=findViewById(R.id.bus_line1);
        line2=findViewById(R.id.bus_line2);
        line3=findViewById(R.id.bus_line3);
        line4=findViewById(R.id.bus_line4);
        line5=findViewById(R.id.bus_line5);
        line1.setOnClickListener(this);
        line2.setOnClickListener(this);
        line3.setOnClickListener(this);
        line4.setOnClickListener(this);
        line5.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.bus_line1://公交站台信息
                BusDialog1 busDialog1=new BusDialog1(0,busActivity.this,myApp);
                busDialog1.show();
                break;
            case R.id.bus_line2://查询公交车位置 没写 接口好像没用
                BusDialog2 busDialog2=new BusDialog2(0,busActivity.this,myApp);
                busDialog2.show();
                break;
            case R.id.bus_line3://查询路况
                BusDialog1 busDialog3=new BusDialog1(1,busActivity.this,myApp);
                busDialog3.show();
                break;
            case R.id.bus_line4://公交车的速度
                BusDialog2 busDialog4=new BusDialog2(1,busActivity.this,myApp);
                busDialog4.show();
                break;
            case R.id.bus_line5://车载容量
                BusDialog2 busDialog5=new BusDialog2(2,busActivity.this,myApp);
                busDialog5.show();
                break;
        }
    }
    @Override
    public void onBackPressed() {
        // super.onBackPressed();
    }
}
